package com.project.service.storeService.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.StoreBean;
import com.project.mapper.storeMapper.IStoreMapper;
import com.project.service.storeService.IStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class StoreServiceImpl implements IStoreService {
    @Autowired
    private IStoreMapper storeMapper;

    @Override
    public void add(StoreBean store) {
        storeMapper.add(store);
    }

    @Override
    public StoreBean findById(int id) {
        return storeMapper.findById(id);
    }

    @Override
    public PageInfo<StoreBean> findByItem(int pageNO, String city, String state) {
        PageHelper.startPage(pageNO,PAGESIZE);
        return PageInfo.of(storeMapper.findByItem(city, state));
    }

    @Override
    public void updateApply(int id, String remark, String state) {
        storeMapper.updateApply(id, remark, state);
    }

    @Override
    public void updateBusiness(int id, String state) {
        storeMapper.updateBusiness(id, state);
    }

    @Override
    public PageInfo<StoreBean> findAll(int pageNO) {
        PageHelper.startPage(pageNO,PAGESIZE);
        return PageInfo.of(storeMapper.findAll());
    }

}
